package com.yxjx.duoxue.datamodel;

import java.io.Serializable;

import org.json.JSONException;
import org.json.JSONObject;

import com.yxjx.duoxue.utils.UIHelper;

/**
 * 认证label
 * @author mengmengchen
 *
 */
public class DMAuth implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1525423382545859237L;
	
	private int id;
	private String authName;
	private String authDes;
	
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getAuthName() {
		return authName;
	}
	public void setAuthName(String authName) {
		this.authName = authName;
	}
	public String getAuthDes() {
		return authDes;
	}
	public void setAuthDes(String authDes) {
		this.authDes = authDes;
	}
	
	public static DMAuth from(String str) {
		if (UIHelper.isEmpty(str)) {
			return null;
		}
		try {
			DMAuth auth = new DMAuth();
			JSONObject jo = new JSONObject(str);
			auth.id = jo.getInt("id");
			auth.authDes = jo.getString("authDes");
			auth.authName = jo.getString("authName");
			return auth;
		} catch (JSONException e) {
			e.printStackTrace();
		}
		return null;
	}

}
